package cn.waka.sys.admin.config;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

import cn.waka.sys.admin.filter.UserSecurityInterceptor;


@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {


    private UserSecurityInterceptor userSecurityInterceptor;


    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userSecurityInterceptor).addPathPatterns("/**");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("classpath:/public/");
        super.addResourceHandlers(registry);
    }

    @Autowired
    public void setUserSecurityInterceptor(UserSecurityInterceptor userSecurityInterceptor) {
        this.userSecurityInterceptor = userSecurityInterceptor;
    }


}
